package com.nulldev.util.web.YouTubeExtractor.signatures.extractors.v9;

import com.nulldev.util.VariableAPI.StringsUtil;
import com.nulldev.util.logging.Logger;
import com.nulldev.util.logging.LoggerFactory;

class SharedV9ExtractorUtil {

	private static final Logger log = LoggerFactory.getLogger();

	public static String getFallbackPayload(final String pCode) {
		return StringsUtil.substringBetweenF(pCode, "{return\"", "+a}return ", "").replace("\"", "");
	}

	public static String makeFallback(final String fallback, final String payload) {
		if (fallback == null || fallback.isEmpty()) {
			log.warn("makeFallback(): fallback was either null or blank!");
			return payload;
		} else
			return fallback + payload;
	}

}
